<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
let ary=[1,"test",100];
/* let a =ary[0]; 
let b =ary[1]; 
let c =ary[3]; */ 

/* let[a,b,c]  =[1,"test",100];
console.log(a,b,c); */

/* let [a,b,c,[e,f],[[g,h]]] =[1,2,3,[4,5],[[6,7]]];
console.log(a,b,c,e,f,g,h); */

//let person = {"name":'张三',"age":19,"cat":{"name":"佩奇","age":2}};

/*let {name,age,cat}=person;

console.log(name,age,cat);

({name,age} = cat)

console.log(name,age);*/
/* 
let {name} = person;

console.log(name);
 */
/*
 let a= [1,2,3,4,5]
 let b = [6,2,5,1,5,9];
 let set = new Set([...a,...b]);
let data = [...set]; 
console.log(set[0]);*/

/*let persons=[{"name":"aaa",
              "cat":{"catname":"cat1"},
              "study":()=>{console.log("在学习")}},
              {"name":"bbbb",
              "cat":{"catname":"cat2"},
              "study":()=>{console.log("在学习")}}
              ]
//显示每个人名字和他的猫的名字,在调用他的学习方法
persons.forEach(person=>{
     let {name,cat:{catname},study} = person;
     console.log(name,catname);
     study();
})*/


let persons=[{"name":"aaa",
              "cat":{"name":"cat1"},
              "study":()=>{console.log("在学习")}},
              {"name":"bbbb",
              "cat":{"name":"cat2"},
              "study":()=>{console.log("在学习")}}
              ]
//显示每个人名字和他的猫的名字,在调用他的学习方法
persons.forEach(person=>{
   let {name,cat,study} = person;
    console.log(name);
    ({name}=cat);
    console.log(name);
   study();
})




</script>